import { createRouter,createWebHistory } from "vue-router";

//导入组件
import Login from '@/view/Login.vue';
import layout from "@/view/layout.vue";
import ArticleCategory from "@/view/article/ArticleCategory.vue";
import ArticleManage from "@/view/article/ArticleManage.vue";
import UserAvatar from "@/view/user/UserAvatar.vue";
import UserInfo from "@/view/user/UserInfo.vue";
import UserResetPassword from "@/view/user/UserResetPassword.vue";


//定义路由关系
const routes = [
    {path: '/login', component: Login},
    {
        path: '/', component: layout,redirect:'/article/manage', children: [
            {path: '/article/category', component: ArticleCategory},
            {path: '/article/manage', component: ArticleManage},
            {path: '/user/info', component: UserInfo},
            {path: '/user/avatar', component: UserAvatar},
            {path: '/user/resetPassword', component: UserResetPassword}
        ]}
]

//创建路由实例
const router = createRouter({
    history: createWebHistory(),
    routes
})

//导出路由实例
export default router;